#ifndef __CONFIG_MGR_H__
#define __CONFIG_MGR_H__

#include <cstdint>
#include <string>
#include <memory>
#include "ReflectJson.hpp"

struct GateServer
{
    uint16_t Port;
    std::string IP;
    std::string Name;

    REFLECT(Port, IP, Name);
};

struct VarifyServer
{
    uint16_t Port;
    std::string IP;

    REFLECT(Port, IP);
};

struct StatusServer
{
    uint32_t PoolSize;
    uint16_t Port;
    std::string IP;

    REFLECT(PoolSize, Port, IP);
};

struct Redis
{
    uint32_t PoolSize;
    uint32_t Port;
    std::string IP;
    std::string Pwd;

    REFLECT(PoolSize, Port, IP, Pwd);
};

struct MySql
{
    uint32_t PoolSize;
    uint32_t Port;
    std::string User;
    std::string DB;
    std::string IP;
    std::string Pwd;

    REFLECT(PoolSize, Port, User, DB, IP, Pwd);
};

struct Config
{
    GateServer LoginServerInfo;
    GateServer GateServerInfo_01;
    GateServer GateServerInfo_02;
    VarifyServer VarifyServerInfo;
    StatusServer StatusServerInfo;
    Redis RedisInfo;
    MySql MySqlInfo;

    REFLECT(LoginServerInfo, GateServerInfo_01, GateServerInfo_02, VarifyServerInfo, StatusServerInfo, RedisInfo, MySqlInfo);
};

class ConfigMgr
{
public:
   ConfigMgr(const ConfigMgr&) = delete;
   ConfigMgr& operator=(const ConfigMgr&) = delete;
   ConfigMgr();

   static void Show(std::shared_ptr<Config> config);

   static std::shared_ptr<Config> GetConfig();

private:
    std::shared_ptr<Config> _config;
};


#endif // __CONFIG_MGR_H__